// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
    head: {
        meta: [
            {
                'http-equiv': 'Content-Security-Policy',
                content: 'upgrade-insecure-requests',
            },
        ],
    },
    runtimeConfig: {
        apiKey: "", // Default to an empty string, automatically set at runtime using process.env.NUXT_API_KEY
        public: {
            // hostURL: "http://localhost", // Exposed to the frontend as well.
            // apiURL: "http://localhost:18003/api", // Exposed to the frontend as well.
            // hostURL: "http://newsroom.exeedinternational.com", // Exposed to the frontend as well.
            // apiURL: "http://newsroom.exeedinternational.com/api", // Exposed to the frontend as well.
        }
    },
    routeRules: {
        '/': {prerender: true},
        '/article/**': {isr: true},
        '/maininfo/**': {isr: true},
        // 针对路径进行接口转发
        '/api/**': {
            cors: true,
            // proxy: `http://localhost:18003/api/**`
            proxy: `https://newsroom.exeedinternational.com/api/**`
        },

    },

    modules: [
        '@element-plus/nuxt',
        '@nuxtjs/robots',
        'nuxt-swiper'
    ],
    swiper: {
    },
    elementPlus: { /** Options */},
    // css: ['element-plus/dist/index.css'],
    devtools: {enabled: true},
    postcss: {
        plugins: {
            // 这个工具可以实现自动添加CSS3前缀
            // "autoprefixer": {
            //   overrideBrowserslist: ["last 5 version", ">1%", "ie >=8"]
            // },
            // 'postcss-pxtorem': {
            //   rootValue: 12, //换算基数，
            //   propList: ['*'], // 属性列表，表示你要把哪些css属性的px转换成rem，这个*表示所有
            //   mediaQuery: false, // 是否允许使用媒体查询，false媒体查询的代码可用，true不可用
            //   exclude: 'ignore',
            //   replace: true, // 替换包含rem的规则，而不是添加回退
            //   minPixelValue: 1, // 需要转换的最小值，一般1px像素不转换，以上才转换
            //   unitPrecision: 6, // 转换成rem单位的小数点后的保留位数
            //   selectorBalckList: ["van"], // 匹配不被转换为rem的选择器
            // },
            "postcss-px-to-viewport-8-plugin": {
                // 配置参数使用与 postcss-px-to-viewport 一致
                viewportWidth: 1920,
                exclude: /node_modules/
            },
        },
    },
    vite: {
        css: {
            preprocessorOptions: {
                scss: {
                    additionalData: '@use "@/assets/styles/default.scss" as *;'
                }
            }
        }
    }
})
